package com.situ.day12;

import org.junit.Test;

public class CalDemo {
    @Test
    public void test1() {
        Add add = new Add(3, 5);
        int result1 = add.getResult();
        System.out.println(result1);

        //Person person = new Student();
        //person = new Teacher();
        //cal: 变量、对象、引用
        Cal cal = new Add(3, 5);
        int result2 = cal.getResult();
        System.out.println(result2);
        cal = new Sub(3, 5);
        int result3 = cal.getResult();
        System.out.println(result3);

        jiSuan(cal);
        jiSuan(add);

        //抽象类是不能new
        //Cal cal1 = new Cal();
    }

    public void jiSuan(Cal cal) {
        int result = cal.getResult();
        //cal.show();
    }

    /*public void jiSuan(Add add) {
        int result = add.getResult();
    }

    public void jiSuan(Sub sub) {
        int result = sub.getResult();
    }

    public void jiSuan(Mul mul) {
        int result = mul.getResult();
    }*/
}
